package cc.rengu.redp.bizimpl.igas.controller;


import cc.rengu.redp.bizimpl.igas.bean.PayChannelNetInfo;
import cc.rengu.redp.bizimpl.igas.service.PayChannelNetEditService;
import cc.rengu.redp.bizimpl.igas.service.PayChannelNetService;
import cc.rengu.redp.common.controller.BaseController;
import cc.rengu.redp.common.domain.QueryRequest;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;

/**
 * 支付通道网路
 */
@Slf4j
@RestController
@Api(tags="系统监控：支付通道网路")
@RequestMapping("/admin/igas/PayChannelNet")
public class PayChannelNetController extends BaseController {
    private final static Logger logger = LoggerFactory.getLogger(PayChannelNetController.class);
    @Autowired
    private PayChannelNetService payChannelNetService;
    @Autowired
    private PayChannelNetEditService payChannelNetEditService;

    @GetMapping("/list")
    public Map<String,Object> findByPage(QueryRequest request, PayChannelNetInfo payChannelNetInfo) throws Exception {
        Map<String,Object> map = getDataTable(this.payChannelNetService.findByKey(request,payChannelNetInfo));
        return map;
    }

    @PostMapping("/edit")
    public Integer edit(PayChannelNetInfo payChannelNetInfo) throws Exception{
        String instId = payChannelNetInfo.getInstId();
        String paramValue = payChannelNetInfo.getParamValue();
        return payChannelNetEditService.editSave(instId,paramValue);
    }
}
